<?php /* Smarty version 2.6.20, created on 2013-05-25 01:44:44
         compiled from _core/_include/common/domutils.tpl */ ?>
<?php require_once(SMARTY_CORE_DIR . 'core.load_plugins.php');
smarty_core_load_plugins(array('plugins' => array(array('function', 'config_load', '_core/_include/common/domutils.tpl', 1, false),array('modifier', 'escape', '_core/_include/common/domutils.tpl', 20, false),)), $this); ?>
<?php echo smarty_function_config_load(array('file' => 'dlmanage.conf'), $this);?>


function DOMUtils() {
};

DOMUtils.removeChildElements = function(elem) {
  while (elem && elem.firstChild) {
    elem.removeChild(elem.firstChild);
  }
};

DOMUtils.removeTableRows = function(table, rowsToKeep) {
  while (table.rows.length > rowsToKeep) {
    table.deleteRow(table.rows.length - 1);
  }
};

DOMUtils.getLoadingImage = function() {
  var img = document.createElement('img');
  img.src = '<?php echo ((is_array($_tmp=$this->_config[0]['vars']['loadingImage'])) ? $this->_run_mod_handler('escape', true, $_tmp, 'javascript') : smarty_modifier_escape($_tmp, 'javascript')); ?>
';
  return img;
};

DOMUtils.createInput = function(name, id, type, value, doc) {
  var input = (!doc) ? document.createElement('input') : doc.createElement('input');
  input.setAttribute('type', type);

  if (name !== null) {
    input.setAttribute('name', name);
  }
  if (id !== null) {
    input.setAttribute('id', id);
  }
  if (value !== null) {
    input.setAttribute('value', value);
  }

  return input;
};

DOMUtils.findPos = function(elem) {
  var curleft = 0, curtop = 0;
  if (elem.offsetParent) {
    curleft = elem.offsetLeft;
    curtop = elem.offsetTop;
    while ((elem = elem.offsetParent)) {
      curleft += elem.offsetLeft;
      curtop += elem.offsetTop;
    }
  }
  return [curleft, curtop];
};

DOMUtils.getEventCode = function(e) {
  var code = null;
  if (!e) {
    e = window.event;
  }
  if (e) {
    if (e.keyCode) {
      code = e.keyCode;
    } else if (e.which) {
      code = e.which;
    }
  }
  return code;
};

DOMUtils.callFunc = function(func, args, context) {
  if (!func) {
    return null;
  }
  return func.apply(context || window, args || []);
};